【PDM教程】1.准备环境

准备 Python 环境

确保你的系统上安装了Python。PDM支持Python 3.7及以上版本。如果您没有安装Python,请从Python官方网站下载并安装最新的稳定版本。

源码安装 Python

CentOS 7 / RHEL 7 源码编译

# Install newer gcc
sudo yum install centos-release-scl -y
sudo yum install devtoolset-7-gcc* -y
source /opt/rh/devtoolset-7/enable
gcc --version

# Install newer openssl 1.1.1w
curl -JLO https://www.openssl.org/source/openssl-1.1.1w.tar.gz
tar zxf openssl-1.1.1w.tar.gz && cd openssl-1.1.1w
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
make -j $(nproc)
sudo make install

# Update the shared libraries cache.
sudo ldconfig
sudo tee /etc/profile.d/openssl.sh<<EOF
export PATH=/usr/local/openssl/bin:\$PATH
export LD_LIBRARY_PATH=/usr/local/openssl/lib:\$LD_LIBRARY_PATH
EOF
source /etc/profile.d/openssl.sh

# Compile python3.11.4 from source
curl -LJO https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz
tar zxf Python-3.11.4.tgz && cd Python-3.11.4
LDFLAGS="${LDFLAGS} -Wl,-rpath=/usr/local/openssl/lib" ./configure --with-openssl=/usr/local/openssl
make -j $(nproc)
sudo make altinstall

# Verify the installation
python3.11 -c "import ssl; print(ssl.OPENSSL_VERSION)"

Mac 源码编译

# Compile python3.11.4 from source
curl -LJO https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz
tar zxf Python-3.11.4.tgz && cd Python-3.11.4
./configure --prefix=${HOME}/software/Python-3.11.4 --enable-optimizations
make -j $(nproc)
make altinstall

注意,如果想在mac apple芯片(如m1/m2等)机型上编译Python2.7,由于Python2系列和Ptyhon3系列3.9版本之前,都不支持arm架构。则可以考虑下载x86的安装器,让apple芯片在Rosetta模式下打开它。

在 Windows 上安装 Python

首先,根据你的Windows版本(64位还是32位)从Python的官方网站下载Python 3.12对应的安装程序,然后,运行下载的exe安装包。

安装 PDM

打开终端或命令提示符,运行以下命令使用pip安装PDM:

pip3.11 install pdm
pdm -V
  • 6
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值