我想我的Mac上有Python和/或pip的问题.我在全球安装了Python 2.7,然后我通常设置virtualenvs并安装Python3.6.4但是在最后一天左右我遇到了诸如Fabric和SSH2这样的软件包的问题,我要么无法安装各种错误,要么安装它们我尝试导入包时抛出的Fabric.
我现在正在尝试删除Fabric并安装Fabric3及其抛出错误,如下所示:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Users/david/Documents/projects/uptimeapp/env/lib/python3.6/site-packages/Fabric3-1.14.post1.dist-info'
Consider using the `--user` option or check the permissions.
(env) Davids-MacBook-Air:uptimeapp david$ pip install fabric3 --user
Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
Run Code Online (Sandbox Code Playgroud)
如果我这样做,sudo pip install fabric 它安装但有这个警告:
The directory '/Users/david/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that …Run Code Online (Sandbox Code Playgroud) 我最近一直在用 Wordpress 和 Docker 创建新站点,并且对它的工作原理有一个合理的了解,我现在希望将一些已建立的站点移到 Docker 中。
我一直在遵循本指南:
https://stephenafamo.com/blog/moving-wordpress-docker-container/
我已经按原样设置了所有内容,但是当我转到我的 domain.com:1234 时,我收到错误消息“建立数据库连接时出错”。我已按照建议将 wp-config.php 中的“DB HOST”更改为“mysql”,并且我引入的站点中的所有 DB 详细信息都是正确的。
我已附加到 mysql 容器并检查数据库是否在那里并且使用了正确的用户,并且还通过 mysql CLI 确保 pw 也是正确的。
SELinux 设置为宽松,我没有更改任何目录/文件所有权或权限,对于后者,目录都是 755 和文件 644,因为它们应该是。
编辑:我应该提到数据库/数据及其下的所有内容似乎归用户/组“polkitd input”而不是 root 所有。
当我在端口 1234 上浏览站点时,除了 WP 容器的 500 错误消息之外,Docker 日志并没有真正告诉我很多信息(尽管如此)。
这是 docker-compose 文件:
version: '2'
services:
example_db:
image: mysql:latest
container_name: example_db
volumes:
- ./database/data:/var/lib/mysql
- ./database/initdb.d:/docker-entrypoint-initdb.d
restart: always
environment:
MYSQL_ROOT_PASSWORD: password123 # any random string will do
MYSQL_DATABASE: mydomin_db # the name of your mysql database
MYSQL_USER: my …Run Code Online (Sandbox Code Playgroud) 我正在尝试学习和理解如何在Python中使用super,我一直在遵循《从新手到专家的Python历程》一书,尽管我觉得我理解概念“在我自己的代码中执行super存在问题”。
例如,此方法对我有用:
class Employee:
def __init__(self, firstname, lastname, age, sex, dob):
self.firstname = firstname
self.lastname = lastname
self.age = age
self.sex = sex
self.dob = dob
self.all_staff.append(self)
class Hourly(Employee):
def __init__(self, firstname, lastname, age, sex, dob, rate, hours):
self.rate = rate
self.hours = hours
super().__init__(firstname, lastname, age, sex, dob)
def __str__(self):
return "{} {}\nAge: {}\nSex: {}\nDOB: {}\n".format(self.firstname, self.lastname, self.age,
self.sex, self.dob)
def get_rate(self):
print('The hourly rate of {} is {} '.format(self.firstname, self.rate))
hourlystaff1 = Hourly('Bob', 'Foo', '23', 'M', '12/1/1980', '$15', …Run Code Online (Sandbox Code Playgroud)